<template>
  <el-upload
    v-model:file-list="fileList"
    class="upload-demo"
    action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
    :on-change="handleChange"
  >
    <el-button type="primary">上传文件</el-button>
    <template #tip>
      <div class="el-upload__tip">支持pdf、doc或docx，不超过5M。</div>
    </template>
  </el-upload>
</template>
<script lang="ts" setup>
import { defineEmits } from "vue";
const props = defineProps({
  lists: {
    type: Array,
    default: () => []
  }
});
const $emit = defineEmits(["delClick"]);
import { ref } from "vue";

import type { UploadProps } from "element-plus";

const fileList = ref(props.lists ?? []);

const handleChange: UploadProps["onChange"] = (uploadFile, uploadFiles) => {
  fileList.value = fileList.value.slice(-3);
};
</script>
